<?php
/* SVN FILE: $Id: admin_index.ctp 34 2009-10-17 13:42:12Z kenreily@gmail.com $ */
/**
 * Short description for file.
 *
 * Long description for file
 *
 * PHP versions 4 and 5
 *
 * Recenseo: Online submission and reviewing for education
 * Copyright 2008-2009, Ken Reily
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * $Date: 2009-10-17 13:42:12 +0000 (Sat, 17 Oct 2009) $
 * $Revision: 34 $
 * $Author: kenreily@gmail.com $
 * $HeadURL: http://recenseo.googlecode.com/svn/trunk/app/views/submissions/admin_index.ctp $
 */
?>
<table>
<?php

  echo $html->tableHeaders(array('ID','Username','Name','Submitted','Comments','Assessments'));

  $total = 0;
  $total_submitted = 0;

  foreach ($submissions as $submission) {
    $submitted = '';
    $assessments = '';
    $submission_id = $submission['submissions']['id'];

    if (!empty($submission_id)) {
      $submitted = $html->link($time->nice($submission['submissions']['created']),"/submissions/view/{$submission_id}");
      $assessments = $submission[0]['assessments'];
      $total_submitted++;
    }

    $comments = '';
    if (!empty($submission['submissions']['comments'])) {
      $comments = '*';
    }

    echo $html->tableCells(array($submission['users']['id'],
                           $submission['users']['username'],
                           $submission['users']['name'],
                           $submitted,
                           $comments,
                           $assessments));
    $total++;
  }
?>
</table>
<p><?=$total_submitted ?> Submissions (out of <?=$total ?> students)</p>